# -*- encoding=utf8 -*-
"""
RedFlag-TC000020   	超过48秒手动裁剪
先进入相机拍摄大于48S的低帧率视频
进入装饰页后选择去裁剪进行手动裁剪
"""
__author__ = "ldm"

import sys
import os
# 获取当前脚本所在目录.py
current_dir = os.path.dirname(os.path.abspath(__file__))
# 获取上级目录.air
parent_dir = os.path.dirname(current_dir)
# 获取上级目录air
grandparent_dir = os.path.dirname(parent_dir)
# 获取和air目录平级的conf、testcase目录路径
conf_dir = os.path.join(grandparent_dir, 'conf')
testcase_dir = os.path.join(grandparent_dir, 'testcase')
# 将conf、testcase目录添加到sys.path
sys.path.append(conf_dir)
sys.path.append(testcase_dir)

from PageFunction import CameraVideoShooter
from elements import *
auto_setup(__file__)

shooter = CameraVideoShooter()
log("-----------------------------------------------超过300秒低帧率视频自动裁剪-------------------------------------------------")
# 进入相册
shooter.enter_album()
# 选择刚才拍摄的视频
shooter.click_element(album_select_button[1])
# 点击下一步
shooter.click_element(album_next_button)
# 等待元素
shooter.wait_for_element_appearance(tip_to_crop_pop_up_window, "10")
# 点击去裁剪
shooter.click_element(tip_to_crop_pop_up_window_cropping)
# 点击保存
shooter.click_element(edit_save)
# 断言是否出现提示弹窗
shooter.assert_element_exists(edit_tooltip_box , "断言失败，未出现裁剪提示弹窗")
# 点击继续编辑
shooter.click_element(edit_tooltip_box_continue_editing)
# 滑动滑块更改视频时长
shooter.slide_element_to_position(edit_video_slider, (0.674, 0.745))
# 点击保存
shooter.click_element(edit_save)
# 断言，判断是否有发布视频按钮
shooter.assert_element_exists(decoration_page_release_video, "断言失败，并未在装饰页找到发布按钮")
# 关闭应用
stop_app(UGC_package_name)